let path = require('path');

module.exports = {
  mode: 'production',
  entry: path.resolve(__dirname, 'src/index.js'),
  // watch: true,
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'main.js',
    library: "PUApi", // 使用require时的模块名
    libraryTarget: "umd", //  产出不同的umd代码
    // 配置打包输出环境，不使用箭头函数
    environment: {
      arrowFunction: false,
      const: false,
    }
  },
  module: {
    rules: [{
      test: /\.js$/,
      exclude: /(node_modules|bower_components)/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: [
            ['@babel/preset-env', {
              useBuiltIns: "usage",
              targets: {
                ie: 10
              }
            }]
          ],

        }
      }
    }]
  },
  externals: {
    axios: 'axios'
  }
};
